<template>
	<view class="main-page-container">
		<view class='main-page-header'>
			<view class="flex flex-row main-page-logo">
				<image src='../../../static/logo.png' class="logo-img"></image>
				<view class="flex justify-center justify-items-center items-center main-text-color-base">{{introductionText}}</view>
			</view>
			<view class="flex flex-row main-page-search">
				<u-search :placeholder="searchKeywordText" @focus="$Router.push({path: '/pages/common/search/search'})"  :showAction="false"></u-search>
			</view>
		</view>
		<swiper class="swiper" circular :indicator-dots="indicatorDots" :indicator-active-color="indicatorActiveColor" :indicator-color="indicatorColor"	 :autoplay="autoplay" :interval="interval"
			:duration="duration">
			<swiper-item>
				<image src="../../../static/imgs/home/banner1.png" class="swiper-item"></image>
			</swiper-item>
			<swiper-item>
				<image src="../../../static/imgs/home/banner2.png" class="swiper-item"></image>
			</swiper-item>
			<swiper-item>
				<image src="../../../static/imgs/home/banner3.png" class="swiper-item"></image>
			</swiper-item>
		</swiper>
		<view class="flex justify-center justify-items-center content-center items-center w-full">
			<view class="page-step-wrap flex content-between justify-between">
				<view class="flex flex-col justify-center justify-items-center content-center items-center page-step-box">
					<image src="../../../static/imgs/home/step1.png" class="icon-img-32"></image>
					<view>下单付款购买</view>
				</view>
				<view class="flex justify-center justify-items-center content-center items-center">
					<image src="../../../static/imgs/home/step-arrow.png" class="icon-img-32"></image>
				</view>
				<view class="flex flex-col justify-center justify-items-center content-center items-center page-step-box">
					<image src="../../../static/imgs/home/step2.png" class="icon-img-32"></image>
					<view>平台保护资金</view>
				</view>
				<view class="flex justify-center justify-items-center content-center items-center">
					<image src="../../../static/imgs/home/step-arrow.png" class="icon-img-32"></image>
				</view>
				<view class="flex flex-col justify-center justify-items-center content-center items-center page-step-box">
					<image src="../../../static/imgs/home/step3.png" class="icon-img-32"></image>
					<view>验货保障正品</view>
				</view>
			</view>
		</view>
		<view class="p-2">
			<image src="../../../static/imgs/home/banner5.png" class="h-32 w-full"></image>
		</view>
		<view class="goods_list">
			<view class="goods_item" v-for="item in goods">
				<image :src="item.logo"></image>
				<view class="price">
					<text>{{item.price}}</text>
					<text>￥2499</text>
				</view>
				<view class="name">
					<text>{{item.name}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				searchKeywordText:'',
				introductionText:'',
				background: ['color1', 'color2', 'color3'],
				indicatorColor: '#FFFFFF',
				indicatorActiveColor: '#8A38F5',
				indicatorDots: true,
				autoplay: true,
				interval: 2000,
				duration: 500,
				goods:[{
					name:'商品一',
					price:'20.36',
					logo:'https://cdn.uviewui.com/uview/album/1.jpg'
				},
				{
					name:'商品二',
					price:'23.36',
					logo:'https://cdn.uviewui.com/uview/album/2.jpg'
				},
				{
					name:'商品三',
					price:'20.36',
					logo:'https://cdn.uviewui.com/uview/album/3.jpg'
				},
				{
					name:'商品四',
					price:'23.36',
					logo:'https://cdn.uviewui.com/uview/album/4.jpg'
				}
				]
			};
		},
		onShow() {
			this.refresh();
		},
		methods: {
			refresh(){
				 this.searchKeywordText = this.$t('common.search-keyword.title');
				 this.introductionText = this.$t('home.introduction.title');
			},
			changeIndicatorDots(e) {
				this.indicatorDots = !this.indicatorDots
			},
			changeAutoplay(e) {
				this.autoplay = !this.autoplay
			},
			intervalChange(e) {
				this.interval = e.target.value
			},
			durationChange(e) {
				this.duration = e.target.value
			}
		}
	}
</script>

<style lang="scss">
.swiper{
	height: 360rpx;
	padding:20rpx;
}
.swiper-item{
	width: 100%;
	height: 360rpx;
}
.top-box{
	border-bottom: 2rpx solid #d9d9d9;
}
.logo-img{
	width: 120rpx;
	height: 80rpx;
}
.main-page-container{
	//padding: 20rpx
}
.main-page-header{
	background: $main-color-theme;
}
.main-page-logo{
	padding:20rpx 20rpx 0 20rpx;
}
.main-page-search{
	padding: 20rpx;
}
.page-step-wrap{
	padding:20rpx;
	background:$main-bg-color-white;
	border-radius:$main-border-radius-base;
}
.page-step-box{
	//width: 120rpx;
	height: 120rpx;
}
.goods_list{
	padding: 0 15rpx;
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	height: 100%;
	position: relative;
	padding-bottom: calc(var(--window-bottom) + 20px);
	.goods_item{
		background: #fff;
		width: 355rpx;
		margin: 10rpx 0;
		padding: 15rpx;
		box-sizing: border-box;
		image{
			width: 100%;
			height: 150px;
			display: block;
			margin: 5px auto;
		}
		.price{
			color: $main-color-auxiliary-five;
			font-size: 36rpx;
			text:nth-child(2){
				color: #ccc;
				font-size: 28rpx;
				margin-left: 17rpx;
				text-decoration: line-through;
			}
		}
		.name{
			font-size: 28rpx;
			line-height: 50rpx;
			padding-bottom: 15rpx;
			padding-top: 10rpx;
		}
	}
}
</style>
